package com.ruoyi.system.service.impl;

import java.util.List;

import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.ruoyi.common.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.system.mapper.LWaybilldetailMapper;
import com.ruoyi.system.domain.LWaybilldetail;
import com.ruoyi.system.service.ILWaybilldetailService;

import static com.ruoyi.common.utils.SecurityUtils.getUserId;

/**
 * 清运单明细Service业务层处理
 *
 * @author zyb
 * @date 2022-01-02
 */
@Service
public class LWaybilldetailServiceImpl extends ServiceImpl<LWaybilldetailMapper, LWaybilldetail> implements ILWaybilldetailService {

    /**
     * 查询清运单明细
     *
     * @param billid 清运单明细主键
     * @return 清运单明细
     */
    @Override
    public LWaybilldetail selectLWaybilldetailByBillid(Long billid) {
        return baseMapper.selectLWaybilldetailByBillid(billid);
    }

    /**
     * 查询清运单明细列表
     *
     * @param lWaybilldetail 清运单明细
     * @return 清运单明细
     */
    @Override
    public List<LWaybilldetail> selectLWaybilldetailList(LWaybilldetail lWaybilldetail) {
        return baseMapper.selectLWaybilldetailList(lWaybilldetail);
    }

    /**
     * 新增清运单明细
     *
     * @param lWaybilldetail 清运单明细
     * @return 结果
     */
    @Override
    public int insertLWaybilldetail(LWaybilldetail lWaybilldetail) {
        lWaybilldetail.setCreateBy(String.valueOf(getUserId()));
        lWaybilldetail.setCreateTime(DateUtils.getNowDate());
        return baseMapper.insertLWaybilldetail(lWaybilldetail);
    }

    /**
     * 修改清运单明细
     *
     * @param lWaybilldetail 清运单明细
     * @return 结果
     */
    @Override
    public int updateLWaybilldetail(LWaybilldetail lWaybilldetail) {
        lWaybilldetail.setUpdateBy(String.valueOf(getUserId()));
        lWaybilldetail.setUpdateTime(DateUtils.getNowDate());
        return baseMapper.updateLWaybilldetail(lWaybilldetail);
    }

    /**
     * 批量删除清运单明细
     *
     * @param billids 需要删除的清运单明细主键
     * @return 结果
     */
    @Override
    public int deleteLWaybilldetailByBillids(Long[] billids) {
        return baseMapper.deleteLWaybilldetailByBillids(billids);
    }

    /**
     * 删除清运单明细信息
     *
     * @param billid 清运单明细主键
     * @return 结果
     */
    @Override
    public int deleteLWaybilldetailByBillid(Long billid) {
        return baseMapper.deleteLWaybilldetailByBillid(billid);
    }
}
